dict1 = {'a': 10, 'b': 8, 'd': 7}
dict2 = {'d': 6, 'c': 4}

dict3 = {}
for i, j in dict1.items():
    dict3[i] = j

for k, v in dict2.items():
    if k in dict3:
        dict3[k] = max(dict3[k], v)
    else:
        dict3[k] = v
print(dict3)